Skip to content

feat(audit): GitHub workflow supply-chain and token-scoping rule expansion - #1975

Merged
lex00 merged 1 commit into
mainfrom
feat/445-supply-chain-token-audits
Aug 26, 2026
Merged

lex00 merged 1 commit into
mainfrom
feat/445-supply-chain-token-audits

Conversation

@lex00

@lex00 lex00 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes gaps #445 named in GitHub Actions workflow auditing: pin provenance, generated-token scope, usage policy, and vulnerability intelligence. Adds four new rules to the github lexicon's post-synth checks, following the existing GHA-series conventions (id, severity, dimension/category, tier, remediation, authority citation) established by #351.

Rule ids + behaviors

  • GHA059 — Stale or missing pin annotation (merge-worthy / guidance). Flags a SHA-pinned uses: with no trailing version comment ("missing"), and — without any network call — flags an internally-inconsistent one: the same commit SHA annotated with two different labels somewhere in the workflow, or the same label attached to two different SHAs ("mismatched"). Either shape proves at least one label is wrong.
  • GHA060 — Over-scoped generated token (merge-worthy / guidance). Targets the well-known GitHub App token actions (actions/create-github-app-token, tibdex/github-app-token, getsentry/action-github-app-token). Flags a minted token whose permission-<scope>: write/admin input is either never referenced by a consuming step ("unused") or shows no textual evidence of that scope being exercised anywhere else in the job ("no-signal").
  • GHA061 — Action reference outside the configured usage policy (merge-worthy / guidance, opt-in). An allow/deny list over third-party uses: references, for environments that constrain which external components may run. Silent when unconfigured.
  • GHA062 — Pinned reference matches a known-vulnerability advisory (merge-worthy / guidance). Cross-references pinned refs (by SHA or tag) against a caller-supplied advisory feed. Degrades to no findings — never an error — when no feed is supplied.

All four are category: "security", and GHA059/060/062 cite an authority (OSSF Scorecard Pinned-Dependencies/Token-Permissions/Vulnerabilities, GitHub hardening docs) — added a new SCORECARD_VULN authority constant to packages/core/src/audit/catalog.ts for GHA062.

How the policy/feed inputs are injected

Per epic #350's design spine, the pure core never fetches or reads the filesystem itself. PostSynthContext carries no per-check runtime config channel today (see the existing TRUSTED_ACTION_OWNERS doc comment for the same constraint on GHA029), so:

  • evaluateUsagePolicy(yaml, policy: ActionUsagePolicy) and checkAdvisories(yaml, feed?: AdvisoryFeed) are exported as pure functions that take their config/feed as a plain argument — fully testable and injectable by any caller.
  • The shipped gha061/gha062 PostSynthChecks (run automatically during chant build/chant lint/chant audit) call these with an empty default (DEFAULT_ACTION_USAGE_POLICY = {}, DEFAULT_ADVISORY_FEED = { entries: [] }) — so by default they report nothing, satisfying "opt-in" and "graceful degradation" directly.
  • A project that wants real enforcement authors a lint.policies entry (chant.config.ts) that imports evaluateUsagePolicy/checkAdvisories and wraps them in its own PostSynthCheck with real data (its allow/deny list, or a pre-fetched/local advisory feed structure) — never a fetch() inside the rule itself.

Test results

npx vitest run lexicons/github packages/core/src/audit
# Test Files  96 passed (96)
# Tests  656 passed (656)

npx vitest run packages/core/src/audit/edge-init-safety.test.ts packages/core/src/audit/bundle-decoupling.test.ts packages/core/src/audit/catalog.test.ts packages/core/src/audit/rules-doc.test.ts
# Test Files  4 passed (4)
# Tests  20 passed (20)

npm run build -w @intentius/chant-lexicon-github
# tsc build succeeds

npx tsc --noEmit -p packages/core/tsconfig.json
# clean

Regenerated lexicons/github/src/lint/post-synth/index.ts via npm run generate:barrels (committed barrel, DO NOT hand-edit) and docs/src/content/docs/lint-rules/audit-rules.mdx via renderRulesReference() to stay in sync with the catalog per rules-doc.test.ts.

Notes for reviewers

Fixes #445

🤖 Generated with Claude Code

…nsion

Adds GHA059-GHA062 to the github lexicon's post-synth checks, closing the
gaps issue #445 named in workflow pin-provenance, generated-token scope,
usage policy, and vulnerability intelligence:

- GHA059 stale/missing pin annotation (flags both a missing trailing
  version comment and an internally-inconsistent one, no network needed).
- GHA060 over-scoped generated GitHub App token (permission-* scopes
  unused or unevidenced by consuming steps).
- GHA061 opt-in action-usage policy (allow/deny lists) — silent unless a
  caller supplies a policy via evaluateUsagePolicy().
- GHA062 advisory cross-reference against an injected vulnerability feed —
  degrades to no findings, never an error, when no feed is supplied.

Per epic #350's design spine, GHA061/GHA062 take their config/feed as a
function argument rather than fetching or reading fs themselves — the
pure core stays network- and fs-free. PostSynthContext carries no
per-check runtime config channel today, so the shipped checks pass an
empty default (matching the existing TRUSTED_ACTION_OWNERS convention);
a project opts in by wrapping evaluateUsagePolicy/checkAdvisories in its
own `lint.policies` check with real data.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lex00
lex00 merged commit ec4d50f into main Aug 26, 2026
6 checks passed
@lex00
lex00 deleted the feat/445-supply-chain-token-audits branch August 26, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expand GitHub workflow supply-chain and token-scoping audits

1 participant